sudo pacman -S --needed libvirt qemu-full virt-manager edk2-ovmf virtio-win samba kdenetwork-filesharing
sudo gpasswd -a h libvirt
sudo systemctl enable --now libvirtd.service

virsh net-destroy default
virsh net-edit default 
<network>
  <name>default</name>
  <bridge name="virbr2"/>
  <forward mode="nat">
    <nat ipv6='yes'>
      <port start='1024' end='65535'/>
    </nat>
  </forward>
  <ip address="192.168.122.1" netmask="255.255.255.0">
    <dhcp>
      <range start="192.168.122.2" end="192.168.122.254"/>
    </dhcp>
  </ip>
  <ip family="ipv6" address="fd00::" prefix="64"/>
</network>
virsh net-start default2
virsh net-autostart default2

# mount qcow2
modprobe nbd max_part=16
qemu-nbd -c /dev/nbd0 /var/lib/libvirt/images/linux2022.qcow2
partprobe /dev/nbd0
fdisk -l /dev/nbd0
mount /dev/nbd0p2 /mnt/kylin --mkdir
umount /mnt/kylin
qemu-nbd -d /dev/nbd0

#Accessing a samba share on my vm from the host
sudo mount --mkdir -t cifs -o username=h,password=2,uid=h,gid=h //WINDOWS/Users/h/Downloads /home/h/Documents/vm_share
smb://WINDOWS/Users/h/Downloads
echo '//WINDOWS/Users/h/Downloads /home/h/Documents/vm_share cifs _netdev,noauto,nofail,user,username=h,password=2,gid=1000,uid=984 0 0' >> /etc/fstab

git clone https://github.com/massgravel/Microsoft-Activation-Scripts.git

sudo useradd guest -s /bin/nologin
echo '[global]
security = user
map to guest = bad user
guest account = guest

[guest_share]
    comment = guest share
    path = /mnt/data/download
    public = yes
    only guest = yes
    writable = yes
    printable = no' | sudo tee -a /etc/samba/smb.conf
sudo systemctl restart smb.service
